package com.nbsaas.boot.customer.rest.resource;

import com.nbsaas.boot.customer.api.apis.CustomerLevelApi;
import com.nbsaas.boot.customer.data.entity.CustomerLevel;
import com.nbsaas.boot.customer.api.domain.request.CustomerLevelRequest;
import com.nbsaas.boot.customer.api.domain.response.CustomerLevelResponse;
import com.nbsaas.boot.customer.api.domain.simple.CustomerLevelSimple;
import com.nbsaas.boot.customer.rest.convert.CustomerLevelSimpleConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerLevelEntityConvert;
import com.nbsaas.boot.customer.rest.convert.CustomerLevelResponseConvert;
import com.nbsaas.boot.customer.data.repository.CustomerLevelRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   客户等级-业务接口实现
*/
@Transactional
@Service
public class CustomerLevelResource extends BaseResource<CustomerLevel,CustomerLevelResponse, CustomerLevelSimple, CustomerLevelRequest>  implements CustomerLevelApi {

    @Resource
    private CustomerLevelRepository customerLevelRepository;

    @Override
    public JpaRepositoryImplementation<CustomerLevel, Serializable> getJpaRepository() {
        return customerLevelRepository;
    }

    @Override
    public Function<CustomerLevel, CustomerLevelSimple> getConvertSimple() {
        return new CustomerLevelSimpleConvert();
    }

    @Override
    public Function<CustomerLevelRequest, CustomerLevel> getConvertForm() {
        return new CustomerLevelEntityConvert();
    }

    @Override
    public Function<CustomerLevel, CustomerLevelResponse> getConvertResponse() {
        return new CustomerLevelResponseConvert();
    }




}


